<%--
  Created by IntelliJ IDEA.
  User: 陈金平
  Date: 2020/11/18
  Time: 15:26
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<html lang="zh-cn">
<head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <script src="js/jquery.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <script type="text/javascript">
        function searchDoctors(page, size) {
            $("#search-form").submit();
        }
    </script>
    <title>医生列表</title>
</head>

<body>
<h1 class="text-center pt-3 pb-3">医生列表</h1>

<div class="container">
    <div class="offset-md-2 col-md-8">
        <div class="row">
            <div class="col-md-10">
                <form class="form-inline">
                    <div class="form-group">
                        <button type="button" onclick="window.open('/go_add.action')"
                                class="btn btn-sm btn-outline-secondary">新增医生
                        </button>
                    </div>
                </form>
            </div>
        </div>

        <hr>

        <form>
            <table class="table table-bordered">
                <thead>
                <tr>
                    <th>编号</th>
                    <th>姓名</th>
                    <th>性别</th>
                    <th>年龄</th>
                    <th>科室</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody>
                <c:forEach items="${doctorPage.dockerList}" var="o">
                    <tr>
                        <td>${o.id}</td>
                        <td>${o.name}</td>
                        <td>${o.sex}</td>
                        <td>${o.age}</td>
                        <td>${o.did}</td>
                        <td>
                            <a href="/doctor_xiangqing.action?id=${o.id}" target="_blank">修改</a> /
                            <a href="/del_doctor.action?id=${o.id}" target="_blank">删除</a>
                        </td>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
        </form>
        <div align="center" style="padding-top: 10px">
            <c:if test="${doctorPage.pageNum == 1}">
                首页 上一页
            </c:if>
            <c:if test="${doctorPage.pageNum != 1}">
                <a href="/all_doctor.action?page=1">首页</a>
                <a href="/all_doctor.action?page=${doctorPage.pageNum-1}">上一页</a>
            </c:if>

            <c:forEach begin="1" end="${doctorPage.pageCount}" var="i">
                <c:if test="${doctorPage.pageNum == i}">
                    ${i}
                </c:if>
                <c:if test="${doctorPage.pageNum != i}">
                    <a href="/all_doctor.action?page=${i}">${i}</a>
                </c:if>
            </c:forEach>

            <c:if test="${doctorPage.pageNum == doctorPage.pageCount}">
                下一页 末页
            </c:if>
            <c:if test="${doctorPage.pageNum != doctorPage.pageCount}">
                <a href="/all_doctor.action?page=${doctorPage.pageNum+1}">下一页</a>
                <a href="/all_doctor.action?page=${doctorPage.pageCount}">末页</a>
            </c:if>
        </div>
    </div>
</div>
</body>
</html>
